package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Random;

public class NewForDemo {
    public static void main(String[] args) {
        Collection<String>c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        Iterator<String>it = c.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        for (String str : c){
            System.out.println(str);
        }
        System.out.println("----------------------------------");
        String[]s = {"one","two","three","four","five"};
        for (int i = 0 ; i < 5 ; i++){
            System.out.println(s[i]);
        }
        for (String str : s){
            System.out.println(str);
        }

    }
}
